<template>
  <div style="padding:20px;">
    <el-form id="consult-form" label-width="20%" class="require-form" size="small" style="width:70%">
      <el-form-item label="经纪人昵称" prop="brokerNickName">
        <el-input v-model="temp.brokerNickName" />
      </el-form-item>
      <el-form-item label="微信" prop="brokerWechat">
        <el-input v-model="temp.brokerWechat" />
      </el-form-item>
      <el-form-item label="QQ" prop="brokerQQ">
        <el-input v-model="temp.brokerQQ" />
      </el-form-item>
      <el-form-item label="手机号" prop="brokerPhone">
        <el-input v-model="temp.brokerPhone" />
      </el-form-item>
      <el-form-item label="性别" prop="brokerSex">
        <template>
          <el-radio v-model="temp.brokerSex" :label="0">男</el-radio>
          <el-radio v-model="temp.brokerSex" :label="1">女</el-radio>
        </template>
      </el-form-item>
      <el-form-item>
        <el-button @click="dialogFormVisible = false">{{ $t('table.cancel') }}</el-button>
        <el-button type="primary" @click="createData()">{{ $t('table.confirm') }}</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import {
	fetchAgentDetailAjax,
	updateAgentAjax
} from "@/api/agentInfo";

// import { fetchEnterPriseListAjax } from "@/api/enterprise";
// import waves from "@/directive/waves"; // Waves directive
// import { parseTime } from "@/utils";
// import Pagination from "@/components/Pagination"; // Secondary package based on el-pagination

export default {
	name: "Collect",
	data() {
		return {
			listLoading: false,
			temp: {},
			formLabelWidth: "150px",
			rules: {}
		};
	},
	created: function() {
		fetchAgentDetailAjax().then(response => {
			console.log(response)
			this.temp = response.data.data;
		})
	},
	methods: {
		createData() {
			updateAgentAjax(this.temp)
				.then(response => {
						this.dialogFormVisible = false;
						this.$notify({
							title: "成功",
							message: "编辑成功",
							type: "success",
							duration: 2000
						});
						this.getList();
				})
				.catch(err => {
					console.log(err);
				});
		}
	}
};
</script>
<style lang="scss">
fieldset {
	margin-bottom: 15px;
	border: 1px solid #e5e5e5;
	padding-left: 15px;
	legend {
		width: auto;
		margin: 0 0 0 -5px;
		font-size: 13px;
		font-weight: bold;
		border-bottom: 0;
		padding: 0 5px;
	}
	ol {
		padding-left: 25px;
	}
	li {
		font-size: 13px;
		color: #141414;
		line-height: 20px;
		margin-top: 3px;
	}
}
</style>
